//首页数据

import request from "@/utils/request"

//1、轮播图数据
export interface CarouselDataItemType{
    id: string
    appAdvertiseUrl:string
}

export type CarouselDataType = CarouselDataItemType[]
export const RequestCarouselData = ()=>{

    return request.get<any,CarouselDataType>(`apis/promotion/ads/search/findByPosition?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&position=pc_mainpage`)
}


//2、请求选择兴趣技能数据
export interface IntSkillsItemType{
    groupType:string,
    id:string,
    name:string
}

export type avocationType =  IntSkillsItemType[]  

export interface ReturnIntSkills{
    avatar:string,
    avocation:avocationType
    id:string,
}
export const RequestIntSkills=()=>{
    return request.get<any,ReturnIntSkills>(`/apis/userCenter/users/me?access_token=12f5e215-07d3-4d51-a591-4599b7daae9a`)
}

//3、获取推荐兴趣的的数据
export interface RecommendItemType{
    groupType: string,
    id: string,
    name: string
}

export type RecommendContentType = RecommendItemType[]

export interface ReturnRecommendIntType {
    content:RecommendContentType
    size:number
    totalElements:number
    totalPages:number
}

export const RequestRecommendInt=(pageNum:number,pageSize:number)=>{
    return request.get<any,ReturnRecommendIntType>(`apis/avocation/avocations/rec/user?access_token=12f5e215-07d3-4d51-a591-4599b7daae9a&pageNum=${pageNum}&pageSize=${pageSize}`)
}


//4、选择推荐后，保存发送请求
export const RequestSavaChooseInt=(ChooseData:RecommendContentType)=>{
    return request.patch('apis/userCenter/users/ff80808183884be3018388bc3da16d5f?access_token=12f5e215-07d3-4d51-a591-4599b7daae9a',{
        avocation:ChooseData
    })
}

//5、查询发请求
export interface SearchIntItemType{
    description: string
    groupType: string
    id:string
    name: string
}

export type SearchIntReturnType = SearchIntItemType[]
export const RequestSearchInt=(name:string)=>{
    return request.get<any,SearchIntReturnType>(`apis/avocation/avocations/search/findByName?access_token=12f5e215-07d3-4d51-a591-4599b7daae9a&name=${name}`)
}



//6、首页默认查询的舞蹈列表
export interface avocationTagsType{
    id: string
    label: string
    name: string
}

//创建者备份(用户信息)
export interface creatorBackupType{
    avatar: string  //头像
    id:string
    level: number
    name: string
    vipGrade: number
}

//点赞评论浏览
export interface statisticsBackupType{
    praiseCount: number //点赞
    commentCount: number //评论
    favoriteCount:number //收藏
    viewCount: number //浏览量
    shareCount: number
}

export interface momentClassificationBackupType{
    classification: string  //
    workTitle: string  //标题
}

export interface DefaultDanceListItemType{
    avocationTags:avocationTagsType[]
    cityId: string
    cityName: string
    cover:string[] //封面
    id:string
    title:string
    creatorBackup:creatorBackupType
    statisticsBackup:statisticsBackupType
    momentClassificationBackup:momentClassificationBackupType
    onsellTime:number
}

export interface DefaultDanceReturnType{
    content:DefaultDanceListItemType[]
    first: boolean
    last: boolean
    numberOfElements: number
    offset: null
    size: number
    totalElements: number
    totalPages: number
    useOffset: boolean
}

//进入首页获取推荐的请求
export const RequestDefaultDanceList=()=>{
    return request.get<any,DefaultDanceReturnType>(`apis/moment/moments/rec/default?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&column=recommend&pageSize=20&pageNum=0&localCache=0`)
}


//进入页面获取筛选nav
export interface choisesItemType{
    id: string
    name: string
}

export interface FilterTermListItemType{
    choises:choisesItemType[]
    formType: string
    label: string
    name: string
    style: string
    valueType: string
}

export type FilterTermListReturnType = FilterTermListItemType[]

export const RequestFilterTermList=(original:string)=>{
    return request.get<any,FilterTermListReturnType>(`apis/moment/properties/filter/${original}?access_token=c494ae44-3adc-48ca-8749-5128a53358d7`)
}


//榜单请求
export const RequestSiftingHot=(newcomer:string)=>{
    return request.post<any,DefaultDanceReturnType>(`apis/moment/moments/collect/original/${newcomer}?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&pageSize=20&pageNum=0&column=original`,{filterInfo: []})
}
export const RequestDefaultDanceList2=(pageNum:number)=>{
    return request.get<any,DefaultDanceReturnType>(`apis/moment/moments/rec/default?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&column=recommend&pageSize=20&pageNum=${pageNum}&localCache=${20*pageNum}`)
}